package com.kbs.im.server.handler;

import com.kbs.im.common.protocol.packet.request.HeartbeatRequestPacket;
import com.kbs.im.common.protocol.packet.response.HeartbeatResponsePacket;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.time.LocalDateTime;

/**
 * @author zhangzhang
 */
public class HeartbeatRequestHandler extends SimpleChannelInboundHandler<HeartbeatRequestPacket> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, HeartbeatRequestPacket msg) throws Exception {
        System.out.println(LocalDateTime.now() + ":收到客户端的心跳检测...");
        ctx.channel().writeAndFlush(new HeartbeatResponsePacket());
    }
}
